package com.example.studentmanagement.service.impl;

import com.example.studentmanagement.entity.Classes;
import com.example.studentmanagement.mapper.ClassMapper;
import com.example.studentmanagement.service.ClassService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 〈功能概述〉<br>
 *
 * @className: ClassServiceImpl
 * @author: 程序员Mars
 * @date: 2024/12/25 23:45
 */
@Service
public class ClassServiceImpl implements ClassService {
    @Autowired
    private ClassMapper classMapper;

    @Override
    public Classes getClassById(Integer id) {
        return classMapper.findById(id);
    }

    @Override
    public List<Classes> getAllClasses() {
        return classMapper.findAll();
    }

    @Override
    public void createClass(Classes cls) {
        classMapper.insert(cls);
    }

    @Override
    public void updateClass(Classes cls) {
        classMapper.update(cls);
    }

    @Override
    public void deleteClass(Integer id) {
        classMapper.deleteById(id);
    }
}